package com.bsg.upm.http;

import org.apache.http.HttpStatus;

public class RespJsonFactory {

	public static RespJson buildOK() {
		return buildInfo(HttpStatus.SC_OK, null, null, null);
	}
	
	public static RespJson buildOK(Object obj) {
		return buildInfo(HttpStatus.SC_OK, null, obj, null);
	}
	
	public static RespJson buildCreated() {
		return buildInfo(HttpStatus.SC_CREATED, null, null, null);
	}
	
	public static RespJson buildCreated(Object obj) {
		return buildInfo(HttpStatus.SC_CREATED, null, obj, null);
	}
	
	public static RespJson buildNoContent() {
		return buildInfo(HttpStatus.SC_NO_CONTENT, null, null, null);
	}
	
	public static RespJson build(Integer status, String msg) {
		return buildInfo(status, msg, null, null);
	}

	public static RespJson buildInfo(Integer status, String msg, Object data, Integer code) {
		RespJson respJson = new RespJson();
		respJson.setStatus(status);
		respJson.setMsg(msg);
		respJson.setData(data);
		respJson.setCode(code);
		return respJson;
	}
}
